package com.mycompany.goodsys.core.ChangeGood;

import com.mycompany.goodsys.basecom.Observer.EventName;
import com.mycompany.goodsys.basecom.Observer.EventSystem;
import com.mycompany.goodsys.core.AppStateCtrl;

public class ChangeGoodCtrl {
    public static void Update() {
        ChangeGoodView.Update();
    }

    private static void BindEvent(){
        EventSystem.BindEvent(EventName.EnterKey,(Object[] objs)->{
            String key = objs[0].toString();
            if(key.equals("back")){
                AppStateCtrl.ChangeState(AppStateCtrl.AppState.MainView);
            }else if(key.length() > 0){
                System.out.print("重复性功能，不写了!");
            }
        });
    }

    public static void Init() {
        BindEvent();
        ChangeGoodData.Init();
        ChangeGoodView.Init();
    }

    public static void Out() {
        EventSystem.RemoveEvent(EventName.EnterKey);
    }
}
